<template>
  <div class='search'>
    <div class="searchInput">
      <div>
        <input type="text" placeholder="搜索经销商/品牌/子品牌/车系/车型/车架号">
      </div>
    </div>
    <div class="weui-cells searchbar-result" >
        <div  class="weui-cell" hover-class="weui-cell_active" v-for="(item,index) in data" :key="index"  :data-val="item"  @click='go_detail'>
        <div class="weui-cell__bd"  >
          <div>{{item}}</div>
        </div>
        </div>
    </div>
    
  </div>
</template>

<script>
  import {mapstate,mapMutations} from "vuex" ;
  export default {
    data() {
      return {
        data: ["第一条数据","第二条数据"]
      }
    },
    methods:{
        go_detail(e){
          if(this.$store.state.user.search.back){       //返回页面并将，搜索的值存储起来
                const val = e.currentTarget.dataset.val
                this.SET_SEARCH_VAL(val);
                wx.navigateBack({delta:1})
              
          }else{
            switch(this.$store.state.user.search.origin){
                    case "出库"  :
                     wx.navigateTo({ url: "/pages/depotOutDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                     case "回款资金方确认":
                      wx.navigateTo({ url: "/pages/financialCapitalDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                      case "回款平台确认":
                      wx.navigateTo({ url: "/pages/financialPlatformDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                      case "自采车辆出库申请":
                      wx.navigateTo({ url: "/pages/carBusinessApplyDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                      case "出库申请业务确认":
                      wx.navigateTo({ url: "/pages/carBusinessConfirmDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                       case "到店业务审核":
                      wx.navigateTo({ url: "/pages/carBusinessAuditingDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                      case "到店高管审核":
                      wx.navigateTo({ url: "/pages/depotAuditingDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                     case "到店交付":
                      wx.navigateTo({ url: "/pages/depotPayDetail/main?id=3333" });         //估计传递什么参数过去吧
                     break;
                     default:
                     break;
            }


          }


        },
        ...mapMutations(["SET_SEARCH_VAL"])
    },
  }
</script>


<style lang="scss" scoped>
  .search {
    height: 100%;

    .searchInput {
      padding-top: 40rpx;

      div {
        position: relative;
      }

      div:after {
        content: "";
        display: block;
        position: absolute;
        top: 18rpx;
        left: 70rpx;
        width: 33rpx;
        height: 34rpx;
        background: url('../../../static/images/search.png') no-repeat;
        background-size: cover;
      }

      input {
        width: 90%;
        height: 60rpx;
        background-color: #ececec;
        border: none;
        // line-height: 60rpx;
        outline: medium;
        border-radius: 20rpx;
        padding-left: 90rpx;
        color: #C1C1C1;
        font-size: 30rpx;
        margin: 0 auto;
        box-sizing: border-box;
      }

    }
  }
</style>
